#!/bin/bash

# stop and disable cups
if [ -f /etc/init/cups.conf ]; then
    service cups stop
    echo "manual" >> /etc/init/cups.override
fi

# create spool
if [ ! -d /var/spool/samba ]; then
    mkdir /var/spool/samba
    chmod 1777 /var/spool/samba
    chown -R root:root /var/spool/samba
    chmod a+rwt /var/spool/samba
fi

# create printer drivers folders
if [ ! -d /var/lib/samba/printers ]; then
    mkdir -p /var/lib/samba/printers/{COLOR,IA64,W32ALPHA,W32MIPS,W32PPC,W32X86,WIN40,x64}
    chown -R root:root /var/lib/samba/printers
    chmod -R g+w /var/lib/samba/printers
fi

exit 0
